package com.tz.crm.service.impl;

import com.tz.crm.dao.ContractDao;
import com.tz.crm.dao.CustomerDao;
import com.tz.crm.dao.PaymentDao;
import com.tz.crm.dao.VisitRecordDao;
import com.tz.crm.service.StatisticalFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 首页实现类
 * Created by Administrator on 2016/11/10.
 */
@Service
@Transactional
public class StatisticalFormServiceImpl implements StatisticalFormService {

    @Autowired
    private VisitRecordDao visitRecordDao;
    @Autowired
    private ContractDao contractDao;
    @Autowired
    private CustomerDao customerDao;
    @Autowired
    private PaymentDao paymentDao;

    @Override
    public int getCountNewCustomer(int awayMonth) {
        return customerDao.getCountNewCustomer(awayMonth);
    }

    @Override
    public int getCountVisitRecorder(int awayMonth) {
        return visitRecordDao.getCount(awayMonth);
    }

    @Override
    public double getSumMoney(int awayMonth) {
        return contractDao.getSumMoney(awayMonth);
    }

    @Override
    public double getSumPaidMoney(int awayMonth) {
        return paymentDao.getSumPaidMoney(awayMonth);
    }

    @Override
    public double getSumUnpaidMoney(int awayMonth) {
        return paymentDao.getSumUnpaidMoney(awayMonth);
    }

}
